<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>缤格</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/binge.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/swiper.min.js"></script>
    <script type="text/javascript" src="../../script/laydate/laydate.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <!-- header -->
    <div class="header">
        <div class="head-back">
            <a href="javascript:void(0);" tapmode onclick="comeBack()" class="back-btn"></a>
        </div>
        <div class="head-title">
            <h6>需求详情</h6>
        </div>
        <!--<div class="head-action">-->
        <!--<a href="javascript:void(0);" tapmode class="action-btn"></a>-->
        <!--</div>-->
    </div>
    <!-- header end -->
</div>
<div class="header-h" style="padding-top: 1.4rem;"></div>
<div class="activity-detail-section" style="padding-bottom: 1.4rem;">
    <div class="act-title" id="title" style="padding: 0.15rem 0; font-size: 0.34rem;">音乐爱好者，一起为音乐疯狂起来</div>
    <div class="act-detail-list" style="padding-top: 0;">
        <div class="detail-view">
            <div class="contentVideo">
                <!--<video class="video-js mb20" preload="true" controls="false" data-setup="{}" src="http://app.unicia.com.cn//static/uploads_file/20200323/12f3fc92da3e6309c29bda0ae4d8a680.mp4" poster="http://app.unicia.com.cn//static/uploads/2020-03-23/mind91777c15f089bc4755572972caecf03.png"><source src="http://app.unicia.com.cn//static/uploads_file/20200323/12f3fc92da3e6309c29bda0ae4d8a680.mp4" type="video/mp4" /></video>-->
            </div>
            <div class="content" id="content">

            </div>
            <dl id="imgList">
                <!--<dd><img src="../../image/banner01.png" alt=""></dd>
                <dd><img src="../../image/banner01.png" alt=""></dd>-->
            </dl>
        </div>
        <!--class: sign1 我要报名，sign2 发布者 ，sign3 已报名-->
        <div class="common-fixed-bottom" id="btn_box">
            <a href="javascript:void(0)" style="display: none;" id="sign2" class="sign-up sign1 mt45"  tapmode onclick="userSignAct('activity_sign')">我要报名</a>
            <a href="javascript:void(0)" style="display: none;" id="sign1" class="sign-up sign2 mt45" tapmode onclick="userCancelAct()">取消发布</a>
            <a href="javascript:void(0)" style="display: none;" id="sign3" class="sign-up sign3 mt45" tapmode onclick="userCancelSign()">取消报名</a>
        </div>
    </div>
</div>


</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<link rel="stylesheet" type="text/css" href="../../script/videoJs/video-js.min.css"/>
<!--<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet"  type="text/css"/>-->
<script type="text/javascript" src="../../script/videoJs/video.min.js"></script>
<script type="text/javascript">
    var activity_id = '';//活动id
    var page = 1;
    apiready = function () {

        setFixStatusBar(); //设置状态栏

        activity_id = api.pageParam.activity_id;
        keybackListener()
        pop.loading();

        //监听报名
        api.addEventListener({
            name: 'signUped'
        }, function (ret, err) {
            getActivityDetail(1)
        });

        //活动详情
        getActivityDetail(1)

    };


    //活动详情
    function getActivityDetail(type) {
        var param = {
            token: $api.getStorage('token'),
            activity_id: activity_id,
            type: type,//类型：1评论列表 2报名人列表
            page: page,
        }
        getAjax(Interface.activity_details, param, function (res) {
            console.log(jsonChange(res))
            var data = res.data.activity;
            if (isDefine(data)) {
                $("#title").html(data.title);
                $("#content").html(data.content);
                $("#content .a_img").each(function () {
                    var _this = $(this);
                    _this.attr('href','javascript:void(0);')
                });

                var img_list = '';
                if (isDefine(data.icons_path)) {
                    for (var i = 0; i < data.icons_path.length; i++) {
                        img_list += '<dd><img src="' + ajaxUrl + data.icons_path[i] + '" alt=""></dd>'
                    }
                    $("#imgList").html(img_list);
                }

                if (isDefine(data.void_path)) {
                    var html = '<video class="video-js mb20" preload="true" controls="false" data-setup="{}" src="'+ ajaxUrl + data.void_path +'" poster="'+ ajaxUrl + data.void_icon_path +'"><source src="'+ ajaxUrl + data.void_path +'" type="video/mp4" /></video>';
                    $(".contentVideo").html(html);
                    getVideoJs();


                }

                if(data.status == 1){
                    if(res.data.stype==1){
                        $("#sign1").show()
                    }else if(res.data.stype==3){
                        $("#sign2").show()
                    }else {
                        $("#sign3").show()
                    }
                }else if (data.status == 2) {
                    //活动结束
                    $("#btn_box").hide();
                }
            }

            pop.close();
        }, function (error) {

            pop.notice(error.msg)
            pop.close();
        })
    }
    //活动报名
    function userSignAct(path) {
        signAct(path,activity_id);
    }

    //取消活动
    function userCancelAct() {
        pop.loading();
        cancelAct(activity_id,function (res) {
            pop.notice(res.msg)
            pop.close();
            setTimeout(function () {
                comeBack()
            },2000)
        })
    }

    //取消活动报名
    function userCancelSign() {
        pop.loading();
        cancelSign(activity_id,function (res) {
            pop.notice(res.msg)
            pop.close();
            setTimeout(function () {
                getActivityDetail(1)
            },1000)
        })
    }




</script>
